home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
ada
/
ada_lrm3.zip
/
LR5BG.SRC
< prev
next >
Wrap
Text File
|
1989-03-28
|
4KB
|
133 lines
-- Ada LRM Reader
package body LRM_GLOBAL is
procedure VALIDATE_CITATION(CITATION_REQUESTED : in STRING;
REQUEST_LENGTH : in NATURAL;
CITATION_TO_GET : out LEGAL_CITATIONS) is
begin
CITATION_TO_GET := LEGAL_CITATIONS'VALUE(CITATION_REQUESTED(1 ..
REQUEST_LENGTH));
end VALIDATE_CITATION;
------------------------------------------------------------------------------
procedure READ_IN_FILE_NAMES(FILE_NAMES_DATA_FILE_NAME: in STRING) is
FILE_NAMES_DATA_FILE: FILE_TYPE;
LENGTH: INTEGER;
begin
OPEN (
FILE => FILE_NAMES_DATA_FILE,
MODE => IN_FILE,
NAME => FILE_NAMES_DATA_FILE_NAME); ---- := "LRMinit "
GET_LINE(FILE_NAMES_DATA_FILE, CHAP_POINTERS_FILE_NAME, LENGTH);
GET_LINE(FILE_NAMES_DATA_FILE, CREDITS_FILE_NAME, LENGTH);
GET_LINE(FILE_NAMES_DATA_FILE, EXPLANATION_FILE_NAME, LENGTH);
GET_LINE(FILE_NAMES_DATA_FILE, LRM_FILE_NAME_PREFIX
, LRM_FILE_NAME_PREFIX_LENGTH);
GET_LINE(FILE_NAMES_DATA_FILE, LRM_READER_SAVE_FILE_NAME, LENGTH);
GET_LINE(FILE_NAMES_DATA_FILE, MENU_MAIN_FILE_NAME, LENGTH);
GET_LINE(FILE_NAMES_DATA_FILE, MENU_ANNEX_FILE_NAME, LENGTH);
GET_LINE(FILE_NAMES_DATA_FILE, MENU_CHAPTER_FILE_NAME, LENGTH);
GET_LINE(FILE_NAMES_DATA_FILE, WELCOME_MSG_FILE_NAME, LENGTH);
CLOSE (FILE => FILE_NAMES_DATA_FILE);
end READ_IN_FILE_NAMES ;
--------------------------------------------------------------------------
procedure GENERATE_CHAP_POINTERS(CHAP_POINTERS : in out CHAP_POINTER_LIST) is
CITATION : LEGAL_CITATIONS;
CITATION_FILE : FILE_TYPE;
LAST : NATURAL;
TEMP_CITATION : STRING(1 .. 60);
--DEBUG_FILE : FILE_TYPE;
begin
OPEN(FILE => CITATION_FILE, MODE => IN_FILE, NAME =>
CHAP_POINTERS_FILE_NAME);
while not END_OF_FILE(CITATION_FILE) loop
TEMP_CITATION := (others => ' ');
GET_LINE(CITATION_FILE, TEMP_CITATION, LAST);
declare
I : NATURAL;
KEEP : NATURAL;
begin
for I in 1 .. 60 loop
case TEMP_CITATION(I) is
when '0' .. '9' | 'C' | 'S' | 'V' | 'P' | 'c' | 'p' | 's' | 'v' =>
null;
when others =>
KEEP := I;
exit;
end case;
end loop;
-- Convert string temp_citation to enumerated variable citation.
---- LEGAL_CITATIONS_IO.GET(CITATION_FILE, CITATION);
CITATION := LEGAL_CITATIONS'VALUE(TEMP_CITATION(1 .. KEEP - 1));
end;
-- GET(CITATION_FILE, CHAP_POINTERS(CITATION));
declare
I : NATURAL;
J : NATURAL;
LASTNUM : NATURAL;
begin
for I in reverse 1 .. 60 loop
case TEMP_CITATION(I) is
when '0' .. '9' =>
LASTNUM := I;
J := I;
loop
J := J - 1;
if TEMP_CITATION(J) = ' ' then
exit;
end if;
end loop;
exit;
when others =>
null;
end case;
end loop;
CHAP_POINTERS(CITATION) := INTEGER'VALUE(TEMP_CITATION(J .. LASTNUM));
end;
end loop;
CLOSE(CITATION_FILE);
end GENERATE_CHAP_POINTERS;
---------------------------------------------------------------------------
------------------------------------------------------------------------------
end LRM_GLOBAL;